package com.bookstore;

import java.util.Calendar;
import com.bookstore.bean.Compra;
import com.bookstore.bean.Usuario;
import com.bookstore.db.BookStoreDB;
import com.bookstore.db.BookStoreDao;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

public class BookStoreActivity extends Activity {
	/** Called when the activity is first created. */
	private static final int ACTIVITY_CATEGORY_LIST = 1;
	private BookStoreDao dao;
	public static Compra compra;
	public static Usuario usuario;
	public static boolean viewCart;
		
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		dao = new BookStoreDao(this);
		
		if (compra == null) {
			compra = new Compra();
			compra.setFecha(Calendar.getInstance().getTime());
		}

		usuario = null;
		viewCart = false;

		ImageButton introButton = (ImageButton) findViewById(R.id.intro);

		introButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View view) {
				dao.update();
				Intent i = new Intent(BookStoreActivity.this,
						ListCategoryActivity.class);
				startActivityForResult(i, ACTIVITY_CATEGORY_LIST);
			}
		});
	}
}
